home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
progs
/
thor
/
stealtagline.thor
< prev
next >
Wrap
Text File
|
1996-11-10
|
3KB
|
122 lines
/*
** $VER: 1.7 (4.6.96)
**
** StealTagline.thor
**
** Steals taglines from the current message
**
** Author: Magne Østlyngen
**
** (C)1994-1996 Ultima Thule Software
*/
options results
Globals = 'HEADTAGS. TEXTTAGS. thorport msg.bbsname msg.confname Globals'
p=address()||' '||show('P',,);if pos('THOR.',p)>0 then thorport=word(,
substr(p,pos('THOR.',p)),1);else do;say 'No THOR port found!';exit 10;end
if ~show('p','BBSREAD') then do;address command;
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead";"WaitForPort BBSREAD";end
address(thorport)
CURRENTMSG STEM msg
if rc~=0 then error('"CURRENTMSG failed: '||THOR.LASTERROR||'"')
address BBSREAD
drop HEADTAGS. TEXTTAGS.
READBRMESSAGE '"'||msg.bbsname||'"' '"'||msg.confname||'"' msg.msgnr headstem HEADTAGS textstem TEXTTAGS
if rc~=0 then error('"READBRMESSAGE failed: '||BBSREAD.LASTERROR||'"')
call ProcessMessagePart('HEADTAGS', 'TEXTTAGS')
drop HEADTAGS. TEXTTAGS.
exit 0
ProcessMessagePart:
interpret 'procedure expose' Globals
parse arg hstem, tstem
if symbol(tstem'.TEXT.COUNT')='VAR' then call ProcessText(tstem'.TEXT.')
if(symbol(tstem'.PART.COUNT') = "VAR") then do
parts = value(tstem'.PART.COUNT')
do n=1 to parts
call ProcessMessagePart(tstem'.PART.'n'.MSG', tstem'.PART.'n'.MSG')
end
end
return 0
ProcessText:
interpret 'procedure expose' Globals
parse arg tstem
drop txt.
ln = value(tstem'count')
if ln=0 then return 0
do while value(tstem||ln) = ""
ln = ln - 1
end
nl = 0
do n = 1 to ln /* FIX: gå ovenfra */
if value(tstem||n) = "" then nl = n
end
txt.count = ln-nl
n = 1
do i = nl + 1 to ln
txt.n = value(tstem||i)
n = n + 1
end
address(thorport)
drop out.
REQUESTLIST txt out '"Select lines to steal"' DRAGSELECT SIZEGADGET
if rc=5 then return 0
if rc~=0 then error('"REQUESTLIST failed: '||THOR.LASTERROR||'"')
if out.count=0 then return 0
drop txt.
address BBSREAD
GETCONFDATA '"'||msg.bbsname||'" "'||msg.confname||'"' conf
if rc~=0 then error('"GETCONFDATA failed: '||BBSREAD.LASTERROR||'"')
tagf=conf.tagfile
if(symbol("conf.tagfile")~="VAR")|(conf.tagfile="")then do
GETBBSDATA '"'||msg.bbsname||'"' bbs
if rc~=0 then error('"GETBBSDATA failed: '||BBSREAD.LASTERROR||'"')
tagf=bbs.tagfile
if(symbol("bbs.tagfile")~="VAR")|(bbs.tagfile="")then do
GETGLOBALDATA glob
if rc~=0 then error('"GETGLOBALDATA failed: '||BBSREAD.LASTERROR||'"')
tagf=glob.tagfile
if(symbol("glob.tagfile")~="VAR")|(glob.tagfile="")then error('"No tagfile configured"')
end
end
address command "echo noline >>"||tagf
if ~open(fil,tagf,A) then error('"Couldn'||"'"||'t open tagfile to append new tag"')
tagline=""
do n = 1 to out.count
tagline = tagline||out.n
if n ~= out.count then tagline = tagline||'\n'
end
call writeln(fil,tagline)
call close(fil)
return 0
error: procedure expose thorport
parse arg err
address(thorport)
say REQUESTNOTIFY err '"_Ok"'
REQUESTNOTIFY err '"_Ok"'
exit 0